<!---
Copyright: (c) 2006 The MachBlog Authors
Authors: Matt Woodward (mpwoodward@gmail.com) & Peter J. Farrell (pjf@maestropublishing.com)

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. 
You may obtain a copy of the License at 

http://www.apache.org/licenses/LICENSE-2.0 

Unless required by applicable law or agreed to in writing, software 
distributed under the License is distributed on an "AS IS" BASIS, 
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
See the License for the specific language governing permissions and 
limitations under the License.

$Id: EntryGateway.cfc 1191 2007-07-14 17:42:46Z pfarrell $

Notes:
--->
<cfcomponent 
	displayname="EntryGateway" 
	output="false" 
	hint="Base EntryGateway for MachBlog">
	
	<!---
	PROPERTIES
	--->
	<cfproperty name="datasource" type="org.machblog.datasource.Datasource" required="true" />
	<cfproperty name="resourceBundleFacade" type="org.machblog.facades.ResourceBundleFacade" required="true" />
	
	<!---
	INITIALIZATION / CONFIGURATION
	--->
	<cffunction name="init" access="public" output="false" returntype="EntryGateway">
		<cfreturn this />
	</cffunction>
	
	<cffunction name="setDatasource" access="public" output="false" returntype="void"
		hint="Dependency: injected">
		<cfargument name="datasource" type="org.machblog.datasource.Datasource" required="true" />
		<cfset variables.datasource = arguments.datasource />
	</cffunction>
	<cffunction name="getDatasource" access="public" output="false" 
			returntype="org.machblog.datasource.Datasource">
		<cfreturn variables.datasource />
	</cffunction>
	
	<cffunction name="setResourceBundleFacade" access="public" output="false" returntype="void"
		hint="Dependency: injected">
		<cfargument name="resourceBundleFacade" type="org.machblog.facades.ResourceBundleFacade" required="true" />
		<cfset variables.resourceBundleFacade = arguments.resourceBundleFacade />
	</cffunction>
	<cffunction name="getResourceBundleFacade" access="public" output="false" 
			returntype="org.machblog.facades.ResourceBundleFacade">
		<cfreturn variables.resourceBundleFacade />
	</cffunction>
	
	<!---
	PUBLIC FUNCTIONS
	--->
	<cffunction name="getEntries" access="public" output="false" returntype="query" 
		hint="Gets mulitple entries by various criteria">
		<cfargument name="getBy" type="string" required="false" default="all" />
		<cfargument name="numDays" type="numeric" required="false" default="0" />
		<cfargument name="categoryId" type="string" required="false" default="" />
		<cfargument name="orderBy" type="string" required="false" default="machblog_entry.dt_posted DESC">
		<cfargument name="numToReturn" type="numeric" required="false" default="-1">
		<cfargument name="searchTerms" type="string" required="false" default="" />
		<cfargument name="getActiveOnly" type="boolean" required="false" default="true" />
		<cfargument name="month" type="numeric" required="false" default="0" />
		<cfargument name="year" type="numeric" required="false" default="0" />
		<cfargument name="currentPosts" type="boolean" required="false" default="false" />
	</cffunction>
	
	<cffunction name="getEntryTitleById" access="public" output="false" returntype="string" 
		hint="Returns an entry title based on the ID passed in">
		<cfargument name="entryId" type="uuid" required="true" />
	</cffunction>

	<cffunction name="getArchiveList" access="public" output="false" returntype="array" 
		hint="Returns an array containing month numbers and the number of entries per month">
		<cfargument name="numMonths" type="numeric" required="true" hint="The number of months to return" />
	</cffunction>
	
	<cffunction name="incrementViews" access="public" output="false" returntype="void" 
		hint="Increments the number of times the entry has been viewed">
		<cfargument name="entryId" type="uuid" required="true" />
	</cffunction>
	
	<cffunction name="getEntryCount" access="public" output="false" returntype="numeric" 
		hint="Returns the total number of entries in the blog (for a specific user if an id is passed in)">
		<cfargument name="userId" type="string" required="false" default="" />
	</cffunction>

</cfcomponent>